<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="uct" uri="/WEB-INF/uct.tld" %>
<%@ taglib prefix="portal" uri="/WEB-INF/portal.tld" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<%@ include file="/common/sale/include/common-base.jsp"%>
	<script src="${ctx}/js/jquery-tools.min.js"></script>
  <script src="${ctx}/js/jquery-tools.min.js"></script>
  <script type="text/javascript" src="${ctx}/js/utr/util.js"></script>
  <script type="text/javascript" src="${ctx}/js/funds.js"></script>
  <title>资金流水</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>
<body class="hold-transition ${sysUserColor} sidebar-mini">
<div class="wrapper">
 <!-- top start -->
  <%@include file="/common/sale/top-user.jsp" %>
  <!-- top end -->
<!-- left start -->
  <%@include file="/common/sale/left-user.jsp" %>
<!-- left end-->
 <!-- main start -->
  <div class="content-wrapper">
	  <div class="content">
		  <div class="row">
			  <div class="col-lg-12 rightmt">
              <!-- right_box2 start -->
                <div class="right_box" style="margin-top:20px;">

					<h4 class="user_title">
						<p><i class="fa fa-sort-amount-asc"></i><span>资金流水</span></p>
					</h4>

                   <!-- 操作流水start -->
                   <div class="nav-tabs-custom" id="totalDiv">
                     
			            <ul id="myTab">
							<!-- <li class="active" id="tab1"><a href="#tab_1" data-toggle="tab"><i class="fa fa-sort-amount-asc"></i> 资金流水</a></li>
                            <li id="tab2"><a href="#tab_2" data-toggle="tab"><i class="fa fa-search"></i> 保证金冻结流水</a></li> -->
			            </ul>

			            <div class="tab-content">
			            <!-- tab1 start -->
					            
		              <div class="tab-pane active" id="tab_1">
		              <form id="searchFrom" class="form-horizontal">
				    	<input type="hidden" name="doCode" value="F006"/>
				    	<input type="hidden" name="actype"  value="FINT,FOUT,DELV,FEDV,FADV,FBDV" />
				     </form>
		              	<table class="table  table-hover user_table" id="fund_all">
		              		<thead>
		              			<tr>
									<th>序号</th>
									<th class="text_l">描述/流水号</th>
									<th>收支（元）</th>
									<th>剩余总资金（元）</th>
									<th>操作时间</th>
								</tr>
		              		</thead>
		              		<tbody id="fundsFlowingDiv">
		              		</tbody>
						</table>
						<center>
		    	  			  <ul id="pageList"></ul>
		        		</center>
		              </div>
	              </div>
	              
          </div>
     <!-- 操作流水end -->
                </div>
              <!-- right_box2 end -->
            </div>
            <!-- right end -->
     </div>
  <!-- mainrow end -->
</div>
<!-- main end -->
     </div>   
  </div>
  
 <!-- main end-->
  
  <!-- foot start -->
  <%@include file="/common/sale/foot-user.jsp" %>
  <!-- foot start -->
  
</div>
  
</div>
</body>

<script type="text/template" id="fundsFlowingDiv_template">
	  				<? for ( var i = 0; i < rows.length; i++) {?>
						<tr>
							<td ><?=(pageObj.currentPage-1)*10+(i+1) ?></td>
							<td class="text_l" title="<?=rows[i].actionId?>">
							<?=rows[i].actionName,30?>

							<?if(rows[i].actionType =="DELV" ){?>
								<?if(rows[i].direction =="in" ){?>
									<font color='red'>（卖出）</font>
								<?}else{?>
									<font color='green'>（买入）</font>
								<?}?>
							<?}?>									
							<br/>
							<font color='#999'><?=rows[i].actionId?>[<?=rows[i].actionType?>]</font>
							</td>
							<td class="text_r"><b>
								<?if(rows[i].direction =="in" ){?><font color='red'>+<?}else{?><font color='green'>-<?}?><?=fmoney(rows[i].amount/100)?></font>	
							</b></td>
							<!--<td class="text_r">
								￥<?=fmoney(rows[i].useAmount/100)?>
							</td>-->
							<td class="text_r">
								￥<?=fmoney(rows[i].leaveAmount/100)?>
							</td>
							<td><?=rows[i].createTime?></td>
						</tr>
					<?}?>
</script>
</html>			
<script>
var clickMenu = 'my-funds-all';
var page_web = "${page_web}";
function opDone(flag,msg){
	
}

	$(function(){
		getTableData();
	});
	
	//查询资金流水明细
	function getTableData(){
		deleteAllRow("fund_all");
		var index_load = layer.load(1, {shade: false});
		var htmsName = "fundsFlowingDiv";
		$.ajax({
			type:'get',
			url: common_list_url,
			async: false,
			data:$('#searchFrom').serialize()+getCurrentPage(common_list_url+"?"+$('#searchFrom').serialize(),10),
			dataType:'json',
			success:function(result){
				console.log(result);
				layer.close(index_load);
				$('#'+htmsName).html("");
			  	var txt = baidu.template(htmsName+'_template',result);
			  	$("#"+htmsName).html(txt);
			  	var option= {
						   ele:$("#pageList")[0],
						   total:result.total,
						   fn:getTableData,
						   url:common_list_url+"?"+$('#searchFrom').serialize()
					   }
				generatePages(option);
			}
		});
	}
	function deleteAllRow(tableId){
		var tb = document.getElementById(tableId);
		if(tb){
		     var rowNum=tb.rows.length;
		     for (var i=1;i<rowNum;i++){
		         tb.deleteRow(i);
		         rowNum=rowNum-1;
		         i=i-1;
		     }
	     }
	}
</script>
